import 'package:flutter/material.dart';

class GridIconCountDemo extends StatelessWidget {
  const GridIconCountDemo({super.key});

  static const showGrid = true; // Set to false to show ListView

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter layout demo',
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Flutter layout demo'),
        ),
        body: Center(child:_buildGrid1()),
      ),
    );
  }


  Widget _buildGrid1() {
    return GridView.count(
      //crossAxisCount  是列组件的数量，由自己定义，再用children来装载内容
      // GridView.extent来与GridView.count不同的是 GridView.extent 通过 maxCrossAxisExtent （组件的最大长度）来控制一行有多少个组件
      crossAxisCount: 3,
      children: const [
        Icon(Icons.add,color:Colors.pink,),
        Icon(Icons.access_time,color: Colors.purple,),
        Icon(Icons.add_alert_sharp,color: Colors.cyanAccent,),
        Icon(Icons.ac_unit,color: Colors.cyanAccent,),
        Icon(Icons.access_time_outlined,color: Colors.amber,),
        Icon(Icons.access_time_filled,color: Colors.deepPurpleAccent,),

      ],
    );
  }
// #enddocregion list
}

